<template>
  <header>
      <div class="l-content">
        <el-button plain @click="collapse" icon="el-icon-menu" size="mini"></el-button>
        <el-breadcrumb separator="/">
            <el-breadcrumb-item v-for="item in tabs" :key="item.path" :to="{ path: item.path }">{{item.label}}</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <div class="r-content">
          <ul>
              <li>
                  <router-link to="/">首页</router-link>
              </li>
              <li>
                  <router-link to="/personal">个人中心</router-link>
              </li>
          </ul>
      </div>
  </header>
</template>

<script>
import { mapState} from 'vuex'
export default {
    name:'CommonHeader',
    methods:{
        collapse(){
            this.$store.commit('collapseMenu')
        }
    },
    computed:{
        ...mapState({
            tabs:state => state.tab.tabsList
        })
    }
}
</script>

<style lang="less" scoped>
header{
    display: flex;
    height: 100%;
    justify-content: space-between;
    align-items: center;
}
.l-content{
    display: flex;
    align-items: center;
        p{
        margin-left: 10px;
        display: inline-block;
        color: #fff;
        font-size: 14px;
        transition: .5s;
        &:hover{
            color: gray;
            cursor: pointer;
        }
    }
    .el-button{
        margin-right: 10px;
    }
}
.r-content{
   ul{
       li{
           padding: 20px;
           display: inline-block;
           a{
               color: black;
           &:hover{
               color: rgb(71, 172, 255);
           }
           }
       }
   }
}
</style>